#!/bin/bash
# description:
#	copy path to clipboard
# dependency:
# 	xsel
# Author: Sid Chen (cnqdcyq@163.com)
# Date: 2022/09/02

## function define
show_help () {
	echo "cppath.sh [-h] <file_name>"
	echo "-------------------------"
	echo " cppath.sh"
	echo "	copy current path to clipboard"
	echo " cppath.sh <file_name>"
	echo "	copy file path to clipboard"
}
case $1 in
	-h )
		show_help;;
	* )
		if [ -z $1 ]; then
			OutPath=$(pwd)
			echo $OutPath | xsel -i -b -p
		else
			OutPath=$(pwd)/$1
			echo $OutPath
			echo $OutPath | xsel -i -b -p
		fi
esac
